package cn.tramy.pinxian.common.util

/**
 * Created by yanjunhua on 2016/10/14.
 */
class PageRequest {
    var pageNo: Int = 1
        private set
    var pageSize: Int = 10
        private set

    private constructor() {}

    constructor(pageNo: Int, pageSize: Int) {
        this.pageNo = pageNo
        this.pageSize = pageSize
    }

    companion object {
        fun validateAndBuild(pageNo: Int, pageSize: Int): PageRequest = PageRequest(if (pageNo < 1) 1 else pageNo, if (pageSize < 1) 10 else pageSize)
    }
}
